
#ifndef _PROCESSROUTER_ZOOKIT_H_
#define _PROCESSROUTER_ZOOKIT_H_

#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <zookeeper/zookeeper.h>
#include "json/json.h"
#include "rf/event/RFEventBase.h"

namespace ProcessRouter {

class ZooKit {
    public:
        ZooKit(std::string group);
        ~ZooKit();

        void connect(std::string host);
        void init(std::string nodename);
        void destroy();
        void set(std::string content);
        void setPageInfo(std::string content);
        bool get(std::string &content, int retry);

    private:
        bool retryFeasible(int zkrc);

        zhandle_t* m_handle;
        std::string m_group;
        std::string m_path;
        std::string m_host;
};

}

#endif

